<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;

class changyanController extends Controller
{
    public function userinfo()
    {

        $wgUser = session('user');
        if($wgUser){
            $avatar = empty($wgUser->head_img)?asset('img/100100.png'):$wgUser->head_img;
            $nickname = empty($wgUser->nickname)?$wgUser->phone:$wgUser->nickname;
            $ret=array(
                "is_login"=>1, //已登录，返回登录的用户信息
                "user"=>array(
                    "user_id"=>$wgUser->id,
                    "nickname"=>$nickname,
                    "img_url"=>$avatar,
                    "profile_url"=>"",
                    "sign"=>"**"
                ));


        }else{
            $ret=array("is_login"=>0);//未登录
        }

        return $_GET['callback'].'('.json_encode($ret).')';
    }

    public function logout()
    {

    }
}
